<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="css/main.css" />
	</head>

	<body>
		<nav class="mui-bar mui-bar-tab">
			<!--<a class="mui-tab-item mui-active" title="首页" href="mainPage.html">
				<span class="mui-icon mui-icon-home"></span>
				<span class="mui-tab-label">首页</span>
			</a>-->
			<a class="mui-tab-item" title="盘点" href="startinventory.html">
				<span class="mui-icon mui-icon-spinner-cycle"></span>
				<span class="mui-tab-label">盘点</span>
			</a>
			<a class="mui-tab-item" title="添加" href="addasset.html">
				<span class="mui-icon mui-icon-plus"></span>
				<span class="mui-tab-label">添加</span>
			</a>
			<a id="search" class="mui-tab-item" title="查看" href="complete.html">
				<span class="mui-icon mui-icon-search"></span>
				<span class="mui-tab-label">查看</span>
			</a>
			<a class="mui-tab-item" title="我的" href="aboutMe.html">
				<span class="mui-icon mui-icon-contact"></span>
				<span class="mui-tab-label">我的</span>
			</a>
		</nav>
		<script src="js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init();
			// 子页面
			var subPage = ['mainPage.html', 'startinventory.html', 'addasset.html','aboutMe.html'];
			// 子页面显示样式
			var subPageStyle = {
				top: '0px',
				bottom: '50px'
			}
			
			// 硬件系统准备就绪执行
			mui.plusReady(function() {
				// 加载当前窗体的webview
				var thisview = plus.webview.currentWebview();
				// 加载所有的子窗体
				for(var i = 0; i < subPage.length; i++) {
					var chview= null;
					chview = plus.webview.create(subPage[i], subPage[i], subPageStyle);
					chview.hide();
					thisview.append(chview);
				}
				//显示首页
				plus.webview.show(subPage[1]);

				// 监听查看菜单
				document.getElementById("#search").addEventListener('click',function(){
				mui.openWindow({
					url:'complete.html',
					id:'complete.html',
					style: {},
      			show: {
							autoShow: true,
							aniShow: 'fade-in',
							duration: 100
						},
						waiting: {
							autoShow: true, //自动显示等待框，默认为true
							title: '正在加载...' //等待对话框上显示的提示内容
						}
				})
			});

			});
			
			
			// 监听底部导航栏
			mui(".mui-bar-tab").on('tap', 'a', function() {
				var title = this.getAttribute("title");
				var page = this.getAttribute("href");
				if(title == '首页') {
					plus.webview.show(this.getAttribute("href"), "fade-in", 100);
				} else {
					mui.openWindow({
						url: page,
						id: page,
						style: {},
						show: {
							autoShow: true,
							aniShow: 'fade-in',
							duration: 100
						},
						waiting: {
							autoShow: true, //自动显示等待框，默认为true
							title: '正在加载...' //等待对话框上显示的提示内容
						}

					})
				}

			})
		</script>

	</body>

</html>